/**
 * Messages.java
 * 
 * (C) 2011 - Mischa Spelt (m.spxxxelt@gmail.com - remove xxx)
 * 
 */
package com.mischa.doedeljas;

/**
 * Static class to define the message codes in the communication protocol.
 * 
 * @author Mischa Spelt
 * 
 */
public class Messages {
	/**
	 * All transmissions end with "0"
	 */
	public static final int END_OF_MESSAGE = 0;

	private static final int MESSAGE = 1000;

	/**
	 * Define several classes of message 
	 */
	private static final int GENERAL = MESSAGE + 00;
	private static final int STARTUP = MESSAGE + 10;
	private static final int GAME = MESSAGE + 20;
	private static final int TRICKS = MESSAGE + 30;

	/**
	 * NONE is a generic value, which can stand for
	 * "no card played", "no player at this position", "score 0", etc.
	 * 
	 * Always use NONE instead of 0, because (int)0 will be seen as END_OF_MESSAGE.
	 */
	public static final int NONE = GENERAL + 0;
	
	/**
	 * JOIN [gameId : int]
	 * Joins the game with the id [gameId], creating it if it doesn't exist.
	 */
	public static final int JOIN = STARTUP + 1;
	
	/**
	 * JOINED [gameId : int] [player : {1,2,3}]
	 * You have joined the game with id [gameId] as player [player]
	 */
	public static final int JOINED = STARTUP + 2;
	
	/**
	 * DEALT [card-1 : Card] ... [card-n : Card]
	 * You have been dealt the given cards
	 */
	public static final int DEALT = GAME + 1;
		
	/**
	 * YOU_DEAL
	 * You are the dealer, and must now dump two cards and choose a trump suit
	 */
	public static final int YOU_DEAL = GAME + 2;
	
	/**
	 * DUMP [card1 : Card] [card2 : Card]
	 * Dump [card1] and [card2] from my hand (only allowed before the game if I am dealer)
	 */
	public static final int DUMP = GAME + 3;
	
	/**
	 * TRUMP [suit : Suit]
	 * Choose [suit] as trump suit (only allowed before the game if I am dealer)
	 */
	public static final int TRUMP = GAME + 4;
	
	/**
	 * TRICK [player : {1,2,3}] [card1 : Card] [card2 : Card] [card3 : Card]
	 * The status of the current trick: players 1 - 3 have played
	 * [card1] through [card3] and player [player] is next to play.
	 */
	public static final int TRICK = TRICKS + 1;
	
	/**
	 * PLAY [card : Card]
	 * Play the specified card in the current trick
	 */
	public static final int PLAY = TRICKS + 5;

}
